<?php 


function get_file($path) {

	if ( function_exists('realpath') )
		$path = realpath($path);

	if ( ! $path || ! @is_file($path) )
		return '';

	return @file_get_contents($path);
}

$css_file = $_GET['load'];

if ( !($css_file) )
	exit;
define('FCPATH',dirname(__FILE__).'/');
$out = get_file(FCPATH.$css_file);

$out = preg_replace( '/jd_linear_gradient\(([^,]+?),([^,]+?)\);?/i',"
	background-color:$1;
	background-image: -moz-linear-gradient(top, $1,$2);
	background-image: -o-linear-gradient(top, $1, $2 50%,$1 99%,$1);
	background-image: -webkit-gradient(linear, left top, left bottom, from($1), to($2));
	filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='$1',EndColorStr='$2');
		
", $out );
$out = preg_replace( '/jd_linear_gradient\((.+?),(.+?),(.+?),(.+?)\);?/i',"
	background-color:$3;
	background-image: -moz-linear-gradient(center top, $1,$2 45%,$3 45%,$4);
	background-image: -o-linear-gradient(top, $1, $2 45%,$3 45%,$1);
	background-image: -webkit-gradient(linear, left top, left bottom, 
		from($1),color-stop(45%, $2),color-stop(45%,$3),  to($4));
	filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='$1',EndColorStr='$3');
", $out );
$out = preg_replace( '/jd_border_radius\((.+?),(.+?),(.+?),(.+?)\);?/i',"
	-webkit-border-top-left-radius: $1;
	-webkit-border-top-right-radius: $2;
	-webkit-border-bottom-right-radius: $3;
	-webkit-border-bottom-left-radius: $4;
	-webkit-border-radius: $1 $2 $3 $4;
	-moz-border-radius: $1 $2 $3 $4;
	border-radius: $1 $2 $3 $4;

", $out );

$out = preg_replace( '/jd_box_shade\((.+?)\);?/i',"
	box-shadow: $1 ;
	-webkit-box-shadow: $1 ;
	-moz-box-shadow: $1 ;
", $out );

$expires_offset = 10;
$compress = false;

header('Content-Type: text/css');
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
header("Cache-Control: public, max-age=$expires_offset");

if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
	header('Vary: Accept-Encoding'); // Handle proxies
	if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
		header('Content-Encoding: deflate');
		$out = gzdeflate( $out, 3 );
	} elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
		header('Content-Encoding: gzip');
		$out = gzencode( $out, 3 );
	}
}


echo $out;
exit;

?>